package br.rfpm.dominio.hibernate.dao;

import java.util.List;

import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;

import br.rfpm.dominio.Authority;
import br.rfpm.dominio.dao.AuthorityDao;
import br.rfpm.hibernate.dao.HibernateGenericDao;

@Repository
public class HibernateAuthorityDao extends HibernateGenericDao<Authority, Long> implements AuthorityDao {

	@Override
	@SuppressWarnings("unchecked")
	public List<Authority> listaPorAuthority(String authority) {
		return getSession().createCriteria(super.getClassEntidade())
				.add(Restrictions.eq("authority", authority)).list();
	}

}
